//
//  HJChatGroupModel.m
//  KaiChat
//
//  Created by lx on 2023/10/23.
//

#import "HJChatGroupModel.h"

@implementation HJChatGroupModel


MJLogAllIvars

//+ (NSDictionary *)mj_replacedKeyFromPropertyName {
//    return @{
//        @"groupId": @"room_id",
//        @"groupOwner": @"owner_id",
//        @"memberNums": @"member_nums",
//        @"openVerify": @"verify_switch",
//        @"hasApply": @"new_apply",
//    };
//}


//- (void)mj_didConvertToObjectWithKeyValues:(NSDictionary *)keyValues {
//    self.groupId = toString(self.groupId);
//    self.groupOwner = toString(self.groupOwner);
//}


+ (HJChatGroupModel *)groupModelWithDict:(NSDictionary *)dict {
    HJChatGroupModel *model = [[HJChatGroupModel alloc] init];
    model.groupId = toString(dict[@"room_id"]);
    model.groupOwner = toString(dict[@"owner_id"]);
    model.avatar = dict[@"avatar"];
    model.memberNums = dict[@"member_nums"];
    model.openVerify = dict[@"verify_switch"];
    model.hasApply = dict[@"new_apply"];
    model.intro = dict[@"intro"];
    model.name = dict[@"name"];
    model.notice = dict[@"notice"];
    model.isTop = dict[@"is_top"];
    model.isMute = dict[@"is_mute"];
    model.role = dict[@"role"];
    model.status = dict[@"status"];
    return model;
}

+ (HJChatGroupModel *)modelWithBlock:(void (^)(HJChatGroupModel *model))block {
    HJChatGroupModel *model = [[HJChatGroupModel alloc] init];
    if (block) block(model);
    return model;
}

+ (NSArray *)bg_uniqueKeys {
    return @[@"groupId"];
}
+ (NSArray *)bg_ignoreKeys {
    return @[@"image", @"searchAttributedString", @"disturb", @"administratorList", @"userList"];
}
 
+ (NSArray *)mj_ignoredPropertyNames {
    return [self bg_ignoreKeys];
}
 
- (NSString *)bg_tableName {
    return [NSString stringWithFormat:@"%@_%@", NSStringFromClass(self.class), HJUserInfo.userId];
}

+ (NSString *)bg_tableName {
    return [NSString stringWithFormat:@"%@_%@", NSStringFromClass(self.class), HJUserInfo.userId];
}

@end
